﻿using System;
using BIS.Portal.Core.Base;
using BIS.Portal.Core.Global;

namespace BIS.Portal.Modules.CMS
{
    public partial class CmsArticleListDisplayControl_Settings : ControlSettingBase
    {
        #region Lấy dữ liệu settings
        public string SLTinHienThi
        {
            get { return GetControlSetting<string>(ModuleSettingNames.CmsArticleListDisplay.txtSoLuongTin,PortalContext.LanguageAlias); }
        }
        public  bool HienThiTieuDeTin
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsArticleListDisplay.ddlTieuDeTin,PortalContext.LanguageAlias);}
        }
        public bool HienThiAnh
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsArticleListDisplay.imgAnh,PortalContext.LanguageAlias); }

        }
        public bool HienThiMoTaTin
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsArticleListDisplay.ddlMotTaTin, PortalContext.LanguageAlias); }
        }
        public bool HienThiLinkCTTin
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsArticleListDisplay.ddlLinkXemCT, PortalContext.LanguageAlias); }
        }
        public bool HienThiTinLienQuan
        {
            get { return GetControlSetting<bool>(ModuleSettingNames.CmsArticleListDisplay.ddlTinLienQuan, PortalContext.LanguageAlias); }
        }
        public string SLTinLienQuan
        {
            get { return GetControlSetting<string>(ModuleSettingNames.CmsArticleListDisplay.txtSLTinLienQuan, PortalContext.LanguageAlias); }
        }
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            loadData();
        }
        private void  loadData()
        {
            txtSLTinHienThi.Text = SLTinHienThi;
            ddlAnhMinhHoaTin.SelectedIndex = HienThiAnh ? 0 : 1;
            ddlTieuDeTin.SelectedIndex = HienThiTieuDeTin ? 0 : 1;
            ddlMotTaTin.SelectedIndex = HienThiMoTaTin ? 0 : 1;
            ddlLinkXemCT.SelectedIndex = HienThiLinkCTTin ? 0 : 1;
            ddlTinLienQuan.SelectedIndex = HienThiTinLienQuan ? 0 : 1;
            txtSLTinLienQuan.Text = SLTinLienQuan;
        }

        public override void SaveSettings(System.Collections.Generic.Dictionary<string, string> settings)
        {
            SetControlSettingForAllLanguages(ddlAnhMinhHoaTin.ID, ModuleSettingNames.CmsArticleListDisplay.imgAnh, settings);
           SetControlSettingForAllLanguages(txtSLTinHienThi.ID,ModuleSettingNames.CmsArticleListDisplay.txtSoLuongTin,settings);
           SetControlSettingForAllLanguages(ddlTieuDeTin.ID, ModuleSettingNames.CmsArticleListDisplay.ddlTieuDeTin, settings);
           SetControlSettingForAllLanguages(ddlMotTaTin.ID, ModuleSettingNames.CmsArticleListDisplay.ddlMotTaTin, settings);
           SetControlSettingForAllLanguages(ddlLinkXemCT.ID, ModuleSettingNames.CmsArticleListDisplay.ddlLinkXemCT, settings);
           SetControlSettingForAllLanguages(ddlTinLienQuan.ID, ModuleSettingNames.CmsArticleListDisplay.ddlTinLienQuan, settings);
           SetControlSettingForAllLanguages(txtSLTinLienQuan.ID, ModuleSettingNames.CmsArticleListDisplay.txtSLTinLienQuan, settings);
        }
    }
}